import axios from '@/lib/apirequest'

export const moduleList = ({token,groupid}) => {
  const data = {
    token,
    groupid
  }
  return axios.request({
    url: 'api_module/modulelist',
    data,
    method: 'post'
  })
}

export const addModule = ({token,modelid,title,width,height,coverimg,groupid,resizetype,datas}) => {
  const data = {
    token,modelid,title,width,height,coverimg,groupid,resizetype,datas
  }
  return axios.request({
    url: 'api_module/addmodule',
    data,
    method: 'post'
  })
}

export const delModule = ({token,id}) => {
  const data = {
    token,
    id
  }
  return axios.request({
    url: 'api_module/delmodule',
    data,
    method: 'post'
  })
}

export const editModule = ({token,id,datas,title,width,height,resizetype,coverimg,headimg}) => {
  const data = {
    token,
    id,
    datas,
    title,
    width,
    height,
    resizetype,
    coverimg,
    headimg
  }
  return axios.request({
    url: 'api_module/editmodule',
    data,
    method: 'post'
  })
}

export const moduleMessage = ({token,id}) => {
  const data = {
    token,
    id
  }
  return axios.request({
    url: 'api_module/modulecontent',
    data,
    method: 'post'
  })
}
